package com.woniuxy.threeproject.end_water_project_user.controller;


import com.woniuxy.threeproject.end_water_project_user.commons.Result;
import com.woniuxy.threeproject.end_water_project_user.domain.form.repairform.RepairForm;
import com.woniuxy.threeproject.end_water_project_user.service.IRepairService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 维修表 前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2021-08-25
 */
@RestController
@RequestMapping("/repair")
@CrossOrigin("*")
@Slf4j
public class RepairController {
    @Autowired
    private IRepairService repairService;
    @GetMapping("/doRepair")
    public Result doRepair(RepairForm repairForm){
        log.info("进入维修业务,{}",repairForm);
        //将数据填入数据库中
        Boolean isOk = repairService.doRepair(repairForm);
        if(isOk){
            return Result.success();
        }
        return Result.fail("DOREPAIR_ERROR","执行添加维修业务出现系统异常");
    }
}

